/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('support-plan', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model EnterpriseDingtalkGroupMember {
  isAdmin?: boolean(name='IsAdmin', description='代表资源名称的资源属性字段', example='true'),
  mobile?: string(name='Mobile', description='代表资源组的资源属性字段', example='130xxxxxxxx'),
  name?: string(name='Name', description='代表创建时间的资源属性字段', example='张三'),
}

model AddEnterpriseGroupMemberToTaskGroupRequest {
  taskOrderId?: string(name='TaskOrderId', description='This parameter is required.', example='E240815B72K5D3'),
  userId?: string(name='UserId', description='This parameter is required.', example='PtWoW82DJI1zcTwsT98kLIgAj7kfASzfC6StcpV7hKs='),
}

model AddEnterpriseGroupMemberToTaskGroupResponseBody = {
  code?: string(name='Code', example='200'),
  data?: string(name='Data', example='true'),
  message?: string(name='Message', example='ok'),
  requestId?: string(name='RequestId', example='43135C31-E47A-5AD7-A693-6DC635201CE4'),
  success?: boolean(name='Success', example='true'),
}

model AddEnterpriseGroupMemberToTaskGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: AddEnterpriseGroupMemberToTaskGroupResponseBody(name='body'),
}

/**
 * @summary 添加客户服务主群人员进子群
 *
 * @param request AddEnterpriseGroupMemberToTaskGroupRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return AddEnterpriseGroupMemberToTaskGroupResponse
 */
async function addEnterpriseGroupMemberToTaskGroupWithOptions(request: AddEnterpriseGroupMemberToTaskGroupRequest, runtime: Util.RuntimeOptions): AddEnterpriseGroupMemberToTaskGroupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.taskOrderId)) {
    query['TaskOrderId'] = request.taskOrderId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'AddEnterpriseGroupMemberToTaskGroup',
    version = '2021-07-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 添加客户服务主群人员进子群
 *
 * @param request AddEnterpriseGroupMemberToTaskGroupRequest
 * @return AddEnterpriseGroupMemberToTaskGroupResponse
 */
async function addEnterpriseGroupMemberToTaskGroup(request: AddEnterpriseGroupMemberToTaskGroupRequest): AddEnterpriseGroupMemberToTaskGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return addEnterpriseGroupMemberToTaskGroupWithOptions(request, runtime);
}

model CreateTaskOrderRequest {
  createUserId?: string(name='CreateUserId', description='This parameter is required.', example='123'),
  isUrgent?: boolean(name='IsUrgent'),
  openGroupId?: string(name='OpenGroupId', description='This parameter is required.', example='cid+lUpHxTIXt7DYqJDcpVxlA=='),
  overview?: string(name='Overview', description='This parameter is required.', example='任务单标题：必填'),
  productCode?: string(name='ProductCode', description='This parameter is required.', example='ecs'),
  urgentDescription?: string(name='UrgentDescription', example='重要性描述'),
}

model CreateTaskOrderResponseBody = {
  code?: string(name='Code', description='code', example='200'),
  data?: string(name='Data', example='E21111796147LE'),
  message?: string(name='Message', description='msg', example='ok'),
  requestId?: string(name='RequestId', description='requestId', example='123'),
  success?: boolean(name='Success', description='success', example='true'),
}

model CreateTaskOrderResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateTaskOrderResponseBody(name='body'),
}

/**
 * @summary 创建工单
 *
 * @param request CreateTaskOrderRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateTaskOrderResponse
 */
async function createTaskOrderWithOptions(request: CreateTaskOrderRequest, runtime: Util.RuntimeOptions): CreateTaskOrderResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.createUserId)) {
    query['CreateUserId'] = request.createUserId;
  }
  if (!Util.isUnset(request.isUrgent)) {
    query['IsUrgent'] = request.isUrgent;
  }
  if (!Util.isUnset(request.openGroupId)) {
    query['OpenGroupId'] = request.openGroupId;
  }
  if (!Util.isUnset(request.overview)) {
    query['Overview'] = request.overview;
  }
  if (!Util.isUnset(request.productCode)) {
    query['ProductCode'] = request.productCode;
  }
  if (!Util.isUnset(request.urgentDescription)) {
    query['UrgentDescription'] = request.urgentDescription;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateTaskOrder',
    version = '2021-07-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 创建工单
 *
 * @param request CreateTaskOrderRequest
 * @return CreateTaskOrderResponse
 */
async function createTaskOrder(request: CreateTaskOrderRequest): CreateTaskOrderResponse {
  var runtime = new Util.RuntimeOptions{};
  return createTaskOrderWithOptions(request, runtime);
}

model ListDdTaskOrderRequest {
  createRealName?: string(name='CreateRealName', description='createRealName', example='Tom'),
  endTime?: string(name='EndTime', description='endTime', example='2024-08-20 14:09:16'),
  isUrgent?: boolean(name='IsUrgent'),
  openGroupId?: string(name='OpenGroupId', description='openGroupId

This parameter is required.', example='DAWNN14N'),
  pageNo?: long(name='PageNo', description='pageNo', example='1'),
  pageSize?: long(name='PageSize', description='pageSize', example='10'),
  startTime?: string(name='StartTime', description='startTime', example='2024-08-01 14:09:11'),
  taskStatus?: string(name='TaskStatus', description='taskStatus', example='dealingNode'),
}

model ListDdTaskOrderResponseBody = {
  code?: string(name='Code', description='code', example='200'),
  data?: string(name='Data', description='data', example='{   "msg": "请求成功",   "code": "200",   "data": [     {       "wfNodeId": "dealingNode",//任务单状态       "createEmpId": null,//创建人工号，可以忽略       "createTime": 1637571435000,//任务单创建时间       "orderId": "E2111221H1UKCZ",//任务单号       "isImportant": "normal",//是否紧急       "closeTime": null,//任务单关单时间       "taskTitle": "测试单16点44",//标题       "productType": "3270"//问题分类     },     {       "wfNodeId": "dealingNode",       "createEmpId": null,       "createTime": 1637820497000,       "orderId": "E211125CG111EM",       "isImportant": "normal",       "closeTime": null,       "taskTitle": "测试单14",       "class": "com.aliyun.dingtalklanding.dto.OpenTaskOrderDTO",       "productType": "3270"     }   ],   "success": true,   "requestId": "123",   "class": "com.aliyun.dingtalklanding.pop.dto.PopResultDTO" }'),
  message?: string(name='Message', description='msg', example='请求成功'),
  requestId?: string(name='RequestId', description='requestId', example='2F8557E4-742B-1CF7-8E83-28CD0C1F7B48'),
  success?: boolean(name='Success', description='success', example='true'),
}

model ListDdTaskOrderResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListDdTaskOrderResponseBody(name='body'),
}

/**
 * @summary ListDdTaskOrder
 *
 * @param request ListDdTaskOrderRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListDdTaskOrderResponse
 */
async function listDdTaskOrderWithOptions(request: ListDdTaskOrderRequest, runtime: Util.RuntimeOptions): ListDdTaskOrderResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.createRealName)) {
    query['CreateRealName'] = request.createRealName;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.isUrgent)) {
    query['IsUrgent'] = request.isUrgent;
  }
  if (!Util.isUnset(request.openGroupId)) {
    query['OpenGroupId'] = request.openGroupId;
  }
  if (!Util.isUnset(request.pageNo)) {
    query['PageNo'] = request.pageNo;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.taskStatus)) {
    query['TaskStatus'] = request.taskStatus;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListDdTaskOrder',
    version = '2021-07-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary ListDdTaskOrder
 *
 * @param request ListDdTaskOrderRequest
 * @return ListDdTaskOrderResponse
 */
async function listDdTaskOrder(request: ListDdTaskOrderRequest): ListDdTaskOrderResponse {
  var runtime = new Util.RuntimeOptions{};
  return listDdTaskOrderWithOptions(request, runtime);
}

model ListEnterpriseDingtalkGroupCustomerMembersRequest {
  openGroupId?: string(name='OpenGroupId', description='This parameter is required.', example='DAWNN14N'),
}

model ListEnterpriseDingtalkGroupCustomerMembersResponseBody = {
  code?: string(name='Code', example='200'),
  data?: [ 
    {
      isAdmin?: boolean(name='IsAdmin'),
      name?: string(name='Name'),
      userId?: string(name='UserId'),
    }
  ](name='Data'),
  message?: string(name='Message', example='Invalid data'),
  requestId?: string(name='RequestId', example='123'),
  success?: boolean(name='Success', example='true'),
}

model ListEnterpriseDingtalkGroupCustomerMembersResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListEnterpriseDingtalkGroupCustomerMembersResponseBody(name='body'),
}

/**
 * @summary 获取钉群中所有客户侧人员信息
 *
 * @param request ListEnterpriseDingtalkGroupCustomerMembersRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListEnterpriseDingtalkGroupCustomerMembersResponse
 */
async function listEnterpriseDingtalkGroupCustomerMembersWithOptions(request: ListEnterpriseDingtalkGroupCustomerMembersRequest, runtime: Util.RuntimeOptions): ListEnterpriseDingtalkGroupCustomerMembersResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.openGroupId)) {
    query['OpenGroupId'] = request.openGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListEnterpriseDingtalkGroupCustomerMembers',
    version = '2021-07-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取钉群中所有客户侧人员信息
 *
 * @param request ListEnterpriseDingtalkGroupCustomerMembersRequest
 * @return ListEnterpriseDingtalkGroupCustomerMembersResponse
 */
async function listEnterpriseDingtalkGroupCustomerMembers(request: ListEnterpriseDingtalkGroupCustomerMembersRequest): ListEnterpriseDingtalkGroupCustomerMembersResponse {
  var runtime = new Util.RuntimeOptions{};
  return listEnterpriseDingtalkGroupCustomerMembersWithOptions(request, runtime);
}

model ListEnterpriseDingtalkGroupsResponseBody = {
  code?: string(name='Code', example='true'),
  data?: [ 
    {
      groupName?: string(name='GroupName', example='A公司服务群'),
      openGroupId?: string(name='OpenGroupId', example='123'),
    }
  ](name='Data'),
  message?: string(name='Message', example='Data Invalid'),
  requestId?: string(name='RequestId', example='12xxxxx'),
  success?: boolean(name='Success', example='true'),
}

model ListEnterpriseDingtalkGroupsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListEnterpriseDingtalkGroupsResponseBody(name='body'),
}

/**
 * @summary 查询所有企业钉群成员
 *
 * @param request ListEnterpriseDingtalkGroupsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListEnterpriseDingtalkGroupsResponse
 */
async function listEnterpriseDingtalkGroupsWithOptions(runtime: Util.RuntimeOptions): ListEnterpriseDingtalkGroupsResponse {
  var req = new OpenApi.OpenApiRequest{};
  var params = new OpenApi.Params{
    action = 'ListEnterpriseDingtalkGroups',
    version = '2021-07-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 查询所有企业钉群成员
 *
 * @return ListEnterpriseDingtalkGroupsResponse
 */
async function listEnterpriseDingtalkGroups(): ListEnterpriseDingtalkGroupsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listEnterpriseDingtalkGroupsWithOptions(runtime);
}

model ListProductByGroupRequest {
  openGroupId?: string(name='OpenGroupId', description='This parameter is required.', example='cidXcezGVQJjiWy2PzXylGwvg=='),
}

model ListProductByGroupResponseBody = {
  code?: string(name='Code', description='code', example='200'),
  data?: string(name='Data', description='data', example='[     {       "wfNodeId": "dealingNode",//任务单状态       "createEmpId": null,//创建人工号，可以忽略       "createTime": 1637571435000,//任务单创建时间       "orderId": "E2111221H1UKCZ",//任务单号       "isImportant": "normal",//是否紧急       "closeTime": null,//任务单关单时间       "taskTitle": "测试单16点44",//标题       "productType": "3270"//问题分类     },     {       "wfNodeId": "dealingNode",       "createEmpId": null,       "createTime": 1637820497000,       "orderId": "E211125CG111EM",       "isImportant": "normal",       "closeTime": null,       "taskTitle": "测试单14",       "class": "com.aliyun.dingtalklanding.dto.OpenTaskOrderDTO",       "productType": "3270"     }   ]'),
  message?: string(name='Message', description='msg', example='请求成功'),
  requestId?: string(name='RequestId', description='requestId', example='123'),
  success?: boolean(name='Success', description='success', example='true'),
}

model ListProductByGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListProductByGroupResponseBody(name='body'),
}

/**
 * @summary 获取问题分类
 *
 * @param request ListProductByGroupRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListProductByGroupResponse
 */
async function listProductByGroupWithOptions(request: ListProductByGroupRequest, runtime: Util.RuntimeOptions): ListProductByGroupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.openGroupId)) {
    query['OpenGroupId'] = request.openGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListProductByGroup',
    version = '2021-07-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取问题分类
 *
 * @param request ListProductByGroupRequest
 * @return ListProductByGroupResponse
 */
async function listProductByGroup(request: ListProductByGroupRequest): ListProductByGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return listProductByGroupWithOptions(request, runtime);
}

